<?php
/**
 * 用来记录错误信息到数据库
 * 
 * User: zjx
 * Date: 2016/11/25
 * Time: 10:32
 */

namespace App\Services\Utils;


use App\Http\Models\Customer;
use App\Http\Models\Log\ErrorLog;

class ErrorLogger
{
    const WECHAT_COMMISSION_FAILED = '微信佣金发放失败';

    /**
     * 微信佣金发放失败
     *
     * @param Customer $customer
     * @param array $result
     * @return ErrorLog
     */
    public static function wechatCommission(Customer $customer, array $result)
    {
        return ErrorLog::create([
            'logable_id'   => $customer->id,
            'logable_type' => class_basename($customer),
            'log'          => self::WECHAT_COMMISSION_FAILED,
            'data'         => $result,
        ]);
    }

    public static function someOtherError()
    {
        // TODO ... create ErrorLog
    }
}